<template>
  <common-crud ref="sysDictItem" v-if="loading" :crudOptionProps="crudOptionProps"
               @listBefore="listBefore2"></common-crud>
</template>

<script>
import commonCrud from "@/components/commonCrud/CommonCrud.vue"

export default {
  name: "sysDictItem",
  components: {commonCrud},
  data() {
    return {
      type: "",
      dictId:"",
      loading: false,
      form:{

      },
      // 表配置
      crudOptionProps: {
        name: 'sys/dictitem',
        apiPrefix: '/sysDictItem',
        // 是否云原生
        functionTarget: 'sysDictItem',
        permissionOption: {
          enable: true

        },
        tableOption: {
          column: [

            {
              label: "字典类型",
              prop: "type",
              search: true,
              disabled: true,
              required: true,
            },

            {
              label: "字典值",
              prop: "value",
              search: true,
              required: true
            },


            {
              label: "字典标签",
              prop: "label",
              search: false,
              required: true,

            },
            {
              label: "字典描述",
              prop: "description",
              search: false,
              required: false
            },


            {
              label: "排序",
              prop: "sort",
              search: false,
              value: 0,
              type: 'number',
              required: true
            },


            {
              label: "样式",
              prop: "style",
              search: false,
              required: true,
              type: 'select',
              dicData: [
                {
                  label: "主要",
                  value: "primary"
                },
                {
                  label: "成功",
                  value: "success"
                },
                {
                  label: "信息",
                  value: "info"
                },
                {
                  label: "警告",
                  value: "warning"
                },
                {
                  label: "危险",
                  value: "danger"
                }

              ]

            },


          ]
        },

      }

    }
  }, created() {
  }, computed() {

  }, methods: {

    init(row, item) {
      console.log("init", row)
      this.type = row.type
      this.dictId = row.id
      this.loading = true;
    },

    listBefore2(params,form) {
      params.type = this.type
      form.type = this.type
      form.dictId = this.dictId
    },

  }
}
</script>

<style scoped>

</style>
